package com.jic.market.common.enums;

import io.swagger.models.auth.In;

import java.util.EnumSet;

/**
 * @author xuyongliang
 * @version V1.0
 * @className DeleteFlagEnum
 * @description 删除标识枚举类
 * @date 2020/2/26
 */


public enum DeleteFlagEnum {
    // 0:未删除,1:删除
    UN_DELETE(0, "未删除"),
    DELETE(1, "删除");

    private Integer code;

    private String value;

    DeleteFlagEnum(Integer code, String value) {
        this.code = code;
        this.value = value;
    }

    public static DeleteFlagEnum getEnumByCode(Integer code){
        EnumSet<DeleteFlagEnum> elements = EnumSet.allOf(DeleteFlagEnum.class);
        for(DeleteFlagEnum enumType : elements){
            if(enumType.getCode().equals(code)){
                return enumType;
            }
        }
        return null;
    }

    public static String getValue(Integer code) {
        return getEnumByCode(code).getValue();
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
}
